import { IPSAppViewMsgGroup } from '../../app/view/ipsapp-view-msg-group';
import { IPSModelObject } from '../../ipsmodel-object';
import { PSModelServiceProxyImpl } from '../../psmodel-service-proxy-impl';

/**
 * 全局默认通用代理
 *
 * @author chitanda
 * @date 2021-07-02 14:07:43
 * @export
 * @class PSAppViewServiceProxy
 * @extends {PSModelServiceProxyImpl}
 */
export class PSAppViewServiceProxy extends PSModelServiceProxyImpl {
  getPSModel4(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    objNode: any,
    strTag: string,
  ): IPSModelObject {
    switch (strTag) {
      case 'getPSAppViewMsgGroup':
        return this.getPSAppViewMsgGroup(
          relatedPSModelObject as IPSAppViewMsgGroup,
          objNode,
        );
    }
    return this.getRealPSModelService().getPSModel4(
      relatedPSModelObject,
      cls,
      objNode,
      strTag,
    );
  }

  getPSAppViewMsgGroup(
    _relatedPSModelObject: IPSAppViewMsgGroup,
    obj: any,
  ): any {
    if (obj.modelref) {
      return this.app.findPSAppViewMsgGroup(obj);
    }
    return null;
  }
}
